# 请在此输入您的代码
t = int(input())
for _ in range(t):
    n = int(input())
    b = n
    a = 1
    while b % 10 == 0:
        a *= 2
        b //= 2
    ans = a + b
    b = n
    a = 1
    while b % 10 == 0:
        b //= 5
        a *= 5
    ans = max(ans, a + b)
    print(ans)
